// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Vuex from 'vuex'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './js/jquery-ui.js'
import './js/newInput_ip.js'

import './js/ajaxfileupload.js'
//import VueResource from 'vue-resource'
import login from './components/login'
import echarts from 'echarts'
import store from './vuex/store.js'
import axios from 'axios'
Vue.prototype.$echarts = echarts
Vue.use(ElementUI)
Vue.use(Vuex)
Vue.prototype.$ajax = axios
//Vue.use(VueResource)
Vue.config.productionTip = false
router.beforeEach(function(to,from,next){
  if(to.path === '/login'){
    next()
  }else{
    if (to.meta.requiresAuth && !sessionStorage.getItem('password')) {
      next({
        path:'/login'
      })
    }else{
      next()
    }
  }
})

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
